<template>
  <canvas ref="bjsCanvas" />
</template>

<script>
import { ref, onBeforeMount, onMounted, onBeforeUpdate, onUpdated, onBeforeUnmount } from "@vue/runtime-core";
import { createScene } from "../scenes/MyFirstScene";
import { VueScreenSizeMixin } from 'vue-screen-size';

export default {
  mixins: [VueScreenSizeMixin],
  name: "BabylonScene",
  setup() {
    const bjsCanvas = ref(null);
    

    onBeforeMount(() => {
      // 在挂载前执行
      
    })

    onMounted(() => {
      if (bjsCanvas.value) {
        createScene(bjsCanvas.value);
      }
    });


    onBeforeUpdate(() => {
      // 在更新前前执行
    })
    onUpdated(() => {
      // 在更新后执行
    })
    onBeforeUnmount(() => {
      // 在组件销毁前执行
    })

    return {
      bjsCanvas,
    };
  },
};
</script>